package com.zking.dao.mapper;

import com.zking.dao.domain.ProfitMonth;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Tanglei
 * @date 2020/8/22 - 9:40
 */
@Repository
public interface PayMapper {

    @Select("SELECT DATE_FORMAT(pay.pay_time,'%Y-%m') as month,SUM(pay.amount) as profit \n" +
            "FROM pay\n" +
            "GROUP BY DATE_FORMAT(pay.pay_time,'%y%m')\n" +
            "ORDER BY month asc")
    List<ProfitMonth> queryAmountMonthly();

    @Select("SELECT SUM(pay.amount) FROM pay")
    Double payAmountTotal();
}
